import req from '@/utils/request.js';
import * as URL from '@/constants/api.js';
export function getCategory(id) {
  return req({
    url: URL.CATEGORY,
    params: {
      id,
    },
  })
    .then((res) => res.data.result)
    .catch((err) => Promise.reject(err.response.data));
}
// 二级分类列表
export function getSubCategoryGoods(params) {
  return req({
    url: URL.SUB_CATEGORY_GOODS,
    method: 'post',
    data: {
      params,
    },
  })
    .then((res) => res.data.result)
    .catch((err) => Promise.reject(err.response.data));
}
export function getSubCategory(id) {
  return req({
    url: URL.SUBCATEGORY,
    params: {
      id,
    },
  })
    .then((res) => res.data.result)
    .catch((err) => Promise.reject(err.response.data));
}
